namespace SupplierCustomerManagement.Read.API.Dtos
{
    /// <summary>
    /// 商品采购价格详情数据传输对象
    /// </summary>
    public class ProductPurchasePriceDetailDto
    {
        /// <summary>
        /// 商品采购价格ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 供应商ID
        /// </summary>
        public int SupplierId { get; set; }

        /// <summary>
        /// 供应商编号
        /// </summary>
        public string SupplierCode { get; set; } = string.Empty;

        /// <summary>
        /// 供应商名称
        /// </summary>
        public string SupplierName { get; set; } = string.Empty;

        /// <summary>
        /// 供应商类型
        /// </summary>
        public string SupplierType { get; set; } = string.Empty;

        /// <summary>
        /// 商品名称
        /// </summary>
        public string ProductName { get; set; } = string.Empty;

        /// <summary>
        /// 商品规格
        /// </summary>
        public string Specification { get; set; } = string.Empty;

        /// <summary>
        /// 计量单位
        /// </summary>
        public string MeasurementUnit { get; set; } = string.Empty;

        /// <summary>
        /// 开票价格
        /// </summary>
        public decimal InvoicePrice { get; set; }

        /// <summary>
        /// 结算价格
        /// </summary>
        public decimal SettlementPrice { get; set; }

        /// <summary>
        /// 折扣
        /// </summary>
        public decimal Discount { get; set; }

        /// <summary>
        /// 公有价格
        /// </summary>
        public decimal PublicPrice { get; set; }

        /// <summary>
        /// 开始日期
        /// </summary>
        public DateTime StartDate { get; set; }

        /// <summary>
        /// 结束日期
        /// </summary>
        public DateTime EndDate { get; set; }

        /// <summary>
        /// 方案名称
        /// </summary>
        public string SchemeName { get; set; } = string.Empty;

        /// <summary>
        /// 备注
        /// </summary>
        public string? Remarks { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdatedTime { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        public int? CreatedBy { get; set; }

        /// <summary>
        /// 更新人ID
        /// </summary>
        public int? UpdatedBy { get; set; }

        /// <summary>
        /// 是否在有效期内
        /// </summary>
        public bool IsValidPeriod => DateTime.Now >= StartDate && DateTime.Now <= EndDate;

        /// <summary>
        /// 有效期状态描述
        /// </summary>
        public string ValidityStatus
        {
            get
            {
                var now = DateTime.Now;
                if (now < StartDate)
                    return "未开始";
                if (now > EndDate)
                    return "已过期";
                return "有效";
            }
        }

        /// <summary>
        /// 剩余天数
        /// </summary>
        public int RemainingDays
        {
            get
            {
                var now = DateTime.Now;
                if (now > EndDate)
                    return 0;
                return (EndDate - now).Days;
            }
        }
    }
} 